import request from '@/config/axios'

export interface DoctorVO {
  id: number
  userId: number
  nickname: string
  code: string
  speciality: number
  remark: string

  avatar: string

}

// 查询医师
export const getDoctor = async (id: number) => {
  return await request.get({ url: '/medical/doctor/get?id=' + id })
}

// 查询列表
export const getDoctorPage = async (params: PageParam) => {
  return await request.get({ url: '/medical/doctor/doctor-page', params })
}

// 查询医生列表
export const getDoctorList = async () => {
  return await request.get({ url: '/medical/doctor/doctor-list' })
}

// 查询指定医生列表
export const getDeptDoctorList = async (deptId: number, period: number, date: Date) => {
  return await request.get({ url: '/medical/doctor/dept-doctor-list?deptId=' + deptId 
                                    +'&period=' + period + '&date=' + date })
}

// 查询有排班医生列表
export const getDoctorSchedule = async (date: Date) => {
  return await request.get({ url: '/medical/doctor/date-doctor-register?date=' + date })
}

export const getRecommenDoctorList = async (doctorIds: number[] ) => {
  return await request.get({ url: '/medical/doctor/doctor-recommend?doctorIds=' + doctorIds })
}

// 查询指定科室医生列表
export const getDoctorInDept = async (deptId: number) => {
  return await request.get({ url: '/medical/doctor/doctor-in-dept?deptId=' + deptId })
}

// 新增医生
export const createDoctor = async (data: DoctorVO) => {
  return await request.post({ url: '/medical/doctor/create', data: data })
}


// 修改医生
export const updateDoctor = async (params: DoctorVO) => {
  return await request.put({ url: '/medical/doctor/update', data: params })
}

// 删除
export const deleteDoctor = async (id: number) => {
  return await request.delete({ url: '/medical/doctor/delete?id=' + id })
}
